const blogInfoService = require("@/server/blog_info");
const { successData, sendCode } = require("@/utils/r/result");

const BlogInfoApi = {
  /**
   * 获取博客设置
   */
  async GetBlogConfig(req, res) {
    let data = await blogInfoService.GetBlogConfig();
    successData(res, data);
  },
  async GetHomeInfo(req, res) {
    let data = await blogInfoService.GetHomeInfo();
    successData(res, data);
  },
  async UpdateBlogConfig(req, res) {
    sendCode(res, await blogInfoService.UpdateBlogConfig(req.body));
  },
  async GetAbout(req, res) {
    successData(res, await blogInfoService.GetAbout());
  },
  async UpdateAbout(req, res) {
    sendCode(res, await blogInfoService.UpdateAbout(req.body));
  },
};

module.exports = BlogInfoApi;
